package docker

//docker 镜像发布
//1.发布镜像到dockerhub上
//2.发布镜像到阿里云

/*

----------发布镜像到阿里云----------


//登录阿里云
	//找到【容器镜像服务】-镜像仓库
	//3.右上角[创建命名空间]，这个命名空间一般是指非常大的项目，然后这个项目里面有很多很多镜像
	//创建命名空间
	//创建容器镜像

	具体步骤看doc文档和参考官方文档
	[root@VM_0_13_centos ~]# docker login --username=朝游东海 registry.cn-hangzhou.aliyuncs.com
	Password:
	WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
	Configure a credential helper to remove this warning. See
	https://docs.docker.com/engine/reference/commandline/login/#credentials-store

	Login Succeeded
	[root@VM_0_13_centos ~]#

	2. 从Registry中拉取镜像
	$ sudo docker pull registry.cn-hangzhou.aliyuncs.com/zydh-docker/zydh-docker:[镜像版本号]


	3. 将镜像推送到Registry
	$ sudo docker login --username=朝游东海 registry.cn-hangzhou.aliyuncs.com
	$ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/zydh-docker/zydh-docker:[镜像版本号]
	$ sudo docker push registry.cn-hangzhou.aliyuncs.com/zydh-docker/zydh-docker:[镜像版本号]


	docker push zydh/myapp:1.0




----------发布镜像到dockerhub上----------


	//发布到docker.hub
	//1.先到docker.hub注册账号
	//2.确定这个账号可以登录
	//3.在我们服务器上提交自己的镜像
	然后在服务器上
	docker login
			--help
		[root@VM_0_13_centos ~]# docker login --help

			Usage:  docker login [OPTIONS] [SERVER]

			Log in to a Docker registry.
			If no server is specified, the default is defined by the daemon.

			Options:
			-p, --password string   Password
			--password-stdin    Take the password from stdin
			-u, --username string   Username
		[root@VM_0_13_centos ~]#

	//登录
	docker login -uusername  然后回车
	Password   这里输入密码

		[root@VM_0_13_centos ~]# docker login -uzydh
		Password:
		WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
		Configure a credential helper to remove this warning. See
		https://docs.docker.com/engine/reference/commandline/login/#credentials-store

		Login Succeeded
		[root@VM_0_13_centos ~]#

	//提交镜像
	docker push 作者名/镜像名[版本号]
	docker push zydh/zydhcentos:1.0
	The push refers to repository [docker.io/zydh/hello-world]
	An image does not exist locally with the tag: zydh/hello-world
	失败，解决
	用docekr tag 改名


	docker tag
	docker tag 镜像id zydh/hello-world:1.0


	docker push zydh/hello-world:1.0


	[root@VM_0_13_centos ~]# docker tag bf756fb1ae65 zydh/hello-world:1.0
	[root@VM_0_13_centos ~]# docker push zydh/hello-world:1.0
	The push refers to repository [docker.io/zydh/hello-world]
	9c27e219663c: Mounted from library/hello-world
	1.0: digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 size: 525
	[root@VM_0_13_centos ~]# docker images
	REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
	dockerfile-entrypoint-test   2.0       7ab51994119f   16 hours ago    209MB
	dockerfile-cmd-test          1.0       0c5a7aae0ef4   16 hours ago    209MB
	zydhcentos                   1.0       0bb85b6bdb73   16 hours ago    291MB
	mysql                        latest    c8562eaf9d81   5 weeks ago     546MB
	golang                       latest    5f46b413e8f5   6 weeks ago     839MB
	nginx                        latest    f6d0b4767a6c   6 weeks ago     133MB
	centos                       latest    300e315adb2f   2 months ago    209MB
	hello-world                  latest    bf756fb1ae65   13 months ago   13.3kB
	zydh/hello-world             1.0       bf756fb1ae65   13 months ago   13.3kB
	[root@VM_0_13_centos ~]#

	//退出 dockerhub
	docker logout






*/
